using UnityEngine;

public class BallMachineController : MonoBehaviour
{
	public Transform shooterHead;

	public Transform lookAtTransform;

	public Vector3 eulerOffset;

	public Transform ballMount;

	public Vector3 desiredLookAtPosition;

	private Animator animator_;

	protected Quaternion prevQuaternion;

	protected Animator animator
	{
		get
		{
			if (animator_ == null)
			{
				animator_ = GetComponent<Animator>();
			}
			return animator_;
		}
	}

	public void Show()
	{
		base.gameObject.SetActive(true);
		prevQuaternion = shooterHead.transform.rotation;
	}

	public void GetUp()
	{
		animator.SetTrigger("GetUp");
	}

	public void MountBall(PhysicsBall ball)
	{
		ball.ParentToObject(ballMount);
		ball.transform.localPosition = Vector3.zero;
	}

	public void PointAt(Vector3 position)
	{
		lookAtTransform.position = position;
	}

	public void LateUpdate()
	{
		prevQuaternion = Quaternion.Lerp(prevQuaternion, Quaternion.LookRotation(lookAtTransform.position - shooterHead.position) * Quaternion.Euler(eulerOffset), RealTime.deltaTime * 3f);
		shooterHead.transform.rotation = prevQuaternion;
	}
}
